#ifndef READINGVALUEMODEL_H
#define READINGVALUEMODEL_H

#include <QAbstractListModel>

// Qt Mobility includes
#include <QSensor>

// Qt Mobility namespace
QTM_USE_NAMESPACE


class ReadingValueModel : public QAbstractListModel
{
    Q_OBJECT
    Q_PROPERTY(int rowCount READ rowCount NOTIFY rowCountChanged)

public: // Data types

    enum SensorModelRoles {
        ValueRole = Qt::UserRole + 1,
    };

public:
    explicit ReadingValueModel(QObject *parent = 0);
    virtual ~ReadingValueModel();

public: // From QAbstractListModel
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    int rowCount(const QModelIndex &parent = QModelIndex()) const;
    void removeRow(int row, const QModelIndex &parent);

public slots:
    bool setSensor(QSensor *sensor);

private slots:
    void update();

signals:
    void rowCountChanged(int count);

private: // Data
    QSensor *m_sensor; // Not owned
    int m_cachedRowCount;
};

#endif // READINGVALUEMODEL_H
